package com.homejoy.system.service.impl;

import java.util.List;

import com.homejoy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.homejoy.system.mapper.HomejoyPropertyFacilityMapper;
import com.homejoy.system.domain.HomejoyPropertyFacility;
import com.homejoy.system.service.IHomejoyPropertyFacilityService;

/**
 * 房源设施Service业务层处理
 *
 * @author homeJoy
 * @date 2025-11-08
 */
@Service
public class HomejoyPropertyFacilityServiceImpl implements IHomejoyPropertyFacilityService {
    @Autowired
    private HomejoyPropertyFacilityMapper homejoyPropertyFacilityMapper;

    /**
     * 查询房源设施
     *
     * @param facilityId 房源设施主键
     * @return 房源设施
     */
    @Override
    public HomejoyPropertyFacility selectHomejoyPropertyFacilityByFacilityId(Long facilityId) {
        return homejoyPropertyFacilityMapper.selectHomejoyPropertyFacilityByFacilityId(facilityId);
    }

    /**
     * 查询房源设施列表
     *
     * @param homejoyPropertyFacility 房源设施
     * @return 房源设施
     */
    @Override
    public List<HomejoyPropertyFacility> selectHomejoyPropertyFacilityList(HomejoyPropertyFacility homejoyPropertyFacility) {
        return homejoyPropertyFacilityMapper.selectHomejoyPropertyFacilityList(homejoyPropertyFacility);
    }

    /**
     * 新增房源设施
     *
     * @param homejoyPropertyFacility 房源设施
     * @return 结果
     */
    @Override
    public int insertHomejoyPropertyFacility(HomejoyPropertyFacility homejoyPropertyFacility) {
        homejoyPropertyFacility.setCreateTime(DateUtils.getNowDate());
        return homejoyPropertyFacilityMapper.insertHomejoyPropertyFacility(homejoyPropertyFacility);
    }

    /**
     * 修改房源设施
     *
     * @param homejoyPropertyFacility 房源设施
     * @return 结果
     */
    @Override
    public int updateHomejoyPropertyFacility(HomejoyPropertyFacility homejoyPropertyFacility) {
        homejoyPropertyFacility.setUpdateTime(DateUtils.getNowDate());
        return homejoyPropertyFacilityMapper.updateHomejoyPropertyFacility(homejoyPropertyFacility);
    }

    /**
     * 批量删除房源设施
     *
     * @param facilityIds 需要删除的房源设施主键
     * @return 结果
     */
    @Override
    public int deleteHomejoyPropertyFacilityByFacilityIds(Long[] facilityIds) {
        return homejoyPropertyFacilityMapper.deleteHomejoyPropertyFacilityByFacilityIds(facilityIds);
    }

    /**
     * 删除房源设施信息
     *
     * @param facilityId 房源设施主键
     * @return 结果
     */
    @Override
    public int deleteHomejoyPropertyFacilityByFacilityId(Long facilityId) {
        return homejoyPropertyFacilityMapper.deleteHomejoyPropertyFacilityByFacilityId(facilityId);
    }
}
